﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <script>
		const pools = ["2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A", "大王", "小王"];
		const types = ["♠", "♥", "♣", "♦"];

		function getRandom(pools, types, count) {
 			const arr = [];
  			for (let i = 0; i < count; i++) {
    			let pool = pools[Math.floor(Math.random() * pools.length)];
    			let type = types[Math.floor(Math.random() * types.length)];
    			let poker = pool === '大王' || pool === '小王' ? pool : type + pool;
    			arr.indexOf(poker) == -1 ? arr.push(poker) : i--;
  			}
  			return arr;
		}

		document.write(getRandom(pools, types, 3));
	</script>
</body>
</回头ml>
